#include "MyModel.h"

MyModel::MyModel(QObject *parent) :
    QSqlTableModel(parent)
{
}

QVariant    MyModel::data(const QModelIndex &idx, int role) const
{
    int col = idx.column();
    switch ( role )
    {
    case Qt::DisplayRole :
        if (col == 2)   // init_time column
        {
            QString time = QSqlTableModel::data(idx, role).toString();
            return time.mid(11, 5);
        }
        break;
    case Qt::TextAlignmentRole :
        return Qt::AlignHCenter + Qt::AlignVCenter;
        break;
    }
    return QSqlTableModel::data(idx, role);
}
